package com.example.football.service;


import com.example.football.dao.PeopleliketeamDao;
import com.example.football.dao.PeoplescheduleDao;
import com.example.football.pojo.Peopleliketeam;
import com.example.football.pojo.Peopleschedule;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class PeoplescheduleServiceImpl implements PeoplescheduleService{
    @Resource
    private PeoplescheduleDao sd;

    @Override
    public List<Peopleschedule> queryAll() {

        return sd.selectAll();
    }

    @Override
    public void removeByPeoplescheduleid(Integer id) {
        try {
            sd.deleteByPeoplescheduleid(id);
        } catch (Exception e) {
            throw new RuntimeException("根据ID删除有异常");
        }
    }

    @Override
    public List<Peopleschedule> queryByPeopleid(String peopleid) {

        return sd.selectByPeopleid(peopleid);
    }

    @Override
    public Peopleschedule queryById(Integer id) {

        return sd.selectById(id);
    }

    @Override
    public void addPeopleschedule(Peopleschedule peopleschedule) {
        try {
            sd.insertPeopleschedule(peopleschedule);
        } catch (Exception e) {
            throw new RuntimeException("添加有异常");
        }
    }

    @Override
    public void changePeopleschedule(Peopleschedule peopleschedule) {
        try {
            sd.updatePeopleschedule(peopleschedule);
        } catch (Exception e) {
            throw new RuntimeException("修改数据异常");
        }
    }
}
